<include file="Index/header"/>
<script language="javascript" type="text/javascript" src="__PUBLIC__/My97DatePicker/WdatePicker.js"></script>


<style>

    select {
        width: 100px;

    }

</style>

<include file="Index/left"/>


<div class="content">

    <div class="header">

        <h1 class="page-title">录入课程资料</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="{:U('Index/Index')}">首页</a> <span class="divider">/</span></li>
        <li><a href="#">课程安排</a> <span class="divider">/</span></li>
        <li class="active">课程信息管理</li>
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">


            <div class="well" id='well2'>
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#home" data-toggle="tab">添加课程信息</a></li>

                </ul>
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <div style="text-align:center">
                            <div>

                                <h3>班次编号:{$bh}&nbsp;&nbsp;&nbsp;&nbsp; 班次名称：{$ccname}</h3>

                            </div>


                            <form id="frm">
                                <table width="100%" border="1">
                                    <tr>
                                        <td width="80" align="center" nowrap="nowrap" bgcolor="#999999">日期</td>
                                        <td width="56" align="center" nowrap="nowrap" bgcolor="#999999">午别</td>
                                        <td width="192" align="center" nowrap="nowrap" bgcolor="#999999">课程</td>
                                        <td width="100" align="center" nowrap="nowrap" bgcolor="#999999">教室</td>

                                        <td width="140" align="center" nowrap="nowrap" bgcolor="#999999">授课人</td>
                                        <td width="100" align="center" nowrap="nowrap" bgcolor="#999999">人数</td>
                                        <td width="140" align="center" nowrap="nowrap" bgcolor="#999999">备注</td>
                                        <td width="50" align="center" nowrap="nowrap" bgcolor="#999999">操作</td>

                                    </tr>

                                    <volist name='sq' id='vo' key='k'>

                                        <tr>
                                            <td rowspan="3" align="center"><p>{$key}</p><input type="hidden"
                                                                                               name="start_time"
                                                                                               id="start_time{$k}"
                                                                                               value="{$key}"> <input
                                                    type="hidden" name="courseid" id="courseid" value="{$bh}">
                                                <p>
                                                    <switch name="key|strtotime|date='w',###">
                                                        <case value="1">(星期一)</case>
                                                        <case value="2">(星期二)</case>
                                                        <case value="3">(星期三)</case>
                                                        <case value="4">(星期四)</case>
                                                        <case value="5">(星期五)</case>
                                                        <case value="6">(星期六)</case>
                                                        <case value="0">(星期日)</case>
                                                        <default/>
                                                        数据错误
                                                    </switch>

                                                </p>
                                            </td>
                                            <td height="25" align="center">上午</td>

                                            <td align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                                            {$vp.coursename}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>

                                                <select name="coursename" id="coursenamesw{$k}">


                                                    <volist name='kc' id='vca'>
                                                        <option value="{$vca.dict_name}">{$vca.dict_name}</option>

                                                    </volist>
                                                </select>

                                            </td>
                                            <td height="25" align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                                            {$vp.class}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <select name="class" id="classsw{$k}">


                                                    <volist name='class' id='vcl'>
                                                        <option value="{$vcl.classname}">{$vcl.classname}</option>

                                                    </volist>
                                                </select>
                                            </td>
                                            <td height="25" align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                                            {$vp.teacher}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <select name="teacher" id="teachersw{$k}">


                                                    <volist name='teacher' id='vcb'>
                                                        <option value="{$vcb.tname}">{$vcb.tname}</option>

                                                    </volist>
                                                </select>

                                            </td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                                            {$vp.number}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <input type="text" name="number" id="numbersw{$k}" style="width:50px;"/>
                                            </td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                                            {$vp.crc}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <input type="text" name="crc" id="crcsw{$k}" style="width:150px;"/></td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')"><a
                                                            onclick="del({$vp['id']})" href="#">&nbsp;&nbsp;x&nbsp;&nbsp;</a>
                                                        <hr/>
                                                    </if>
                                                </volist>
                                                <a href="#" onclick="sendsj('sw',{$k})">&nbsp;&nbsp;√&nbsp;&nbsp;</a>
                                            </td>

                                        </tr>
                                        <tr>
                                            <td align="center" height="38">下午</td>

                                            <td align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')">
                                                            {$vp.coursename}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <select name="coursename" id="coursenamexw{$k}">


                                                    <volist name='kc' id='vca'>
                                                        <option value="{$vca.dict_name}">{$vca.dict_name}</option>

                                                    </volist>
                                                </select>
                                            </td>
                                            <td height="25" align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')">
                                                            {$vp.class}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <select name="class" id="classxw{$k}">


                                                    <volist name='class' id='vcl'>
                                                        <option value="{$vcl.classname}">{$vcl.classname}</option>

                                                    </volist>
                                                </select>
                                            </td>
                                            <td height="25" align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')">
                                                            {$vp.teacher}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>

                                                <select name="teacher" id="teacherxw{$k}">


                                                    <volist name='teacher' id='vcb'>
                                                        <option value="{$vcb.tname}">{$vcb.tname}</option>

                                                    </volist>
                                                </select>
                                            </td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')">
                                                            {$vp.number}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <input type="text" name="number" id="numberxw{$k}" style="width:50px;"/>
                                            </td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')">
                                                            {$vp.crc}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <input type="text" name="crc" id="crcxw{$k}" style="width:150px;"/></td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')"><a
                                                            onclick="del({$vp['id']})" href="#">&nbsp;&nbsp;x&nbsp;&nbsp;</a>
                                                        <hr/>
                                                    </if>
                                                </volist>
                                                <a href="#" onclick="sendsj('xw',{$k})">&nbsp;&nbsp;√&nbsp;&nbsp;</a>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td height="25" align="center">晚上</td>

                                            <td align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')">
                                                            {$vp.coursename}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>

                                                <select name="coursename" id="coursenameww{$k}">


                                                    <volist name='kc' id='vca'>
                                                        <option value="{$vca.dict_name}">{$vca.dict_name}</option>

                                                    </volist>
                                                </select>

                                            </td>
                                            <td height="25" align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')">
                                                            {$vp.class}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <select name="class" id="classww{$k}">


                                                    <volist name='class' id='vcl'>
                                                        <option value="{$vcl.classname}">{$vcl.classname}</option>

                                                    </volist>
                                                </select>
                                            </td>
                                            <td height="25" align="center" nowrap="nowrap">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')">
                                                            {$vp.teacher}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <select name="teacher" id="teacherww{$k}">


                                                    <volist name='teacher' id='vcb'>
                                                        <option value="{$vcb.tname}">{$vcb.tname}</option>

                                                    </volist>
                                                </select>

                                            </td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')">
                                                            {$vp.number}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <input type="text" name="number" id="numberww{$k}" style="width:50px;"/>
                                            </td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <p>
                                                        <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')">
                                                            {$vp.crc}
                                                            <hr/>
                                                        </if>
                                                    </p>
                                                </volist>
                                                <input type="text" name="crc" id="crcww{$k}" style="width:150px;"/></td>
                                            <td align="center" nowrap="nowrap" height="25">
                                                <volist name='vo' id='vp'>
                                                    <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')"><a
                                                            onclick="del({$vp['id']})" href="#">&nbsp;&nbsp;x&nbsp;&nbsp;</a>
                                                        <hr/>
                                                    </if>
                                                </volist>
                                                <a href="#" onclick="sendsj('ww',{$k})">&nbsp;&nbsp;√&nbsp;&nbsp;</a>
                                            </td>
                                        </tr>

                                    </volist>
                                </table>
                            </form>
                        </div>
                        <br/>
                        <if condition="$sd neq ''">
                            <div><a href="{:U('Curriculum/addcurr',array('fs'=>'up','sd'=>$sd,'bh'=>$bh))}">
                                <button type="button" class="btn btn-default btn-lg">上一周</button>
                            </a>&nbsp;&nbsp;| &nbsp;&nbsp;<a href="{:U('Curriculum/addcurr',array('fs'=>'now'))}">
                                <button type="button" class="btn btn-default btn-lg">本周</button>
                            </a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
                                    href="{:U('Curriculum/addcurr',array('fs'=>'down','sd'=>$sd,'bh'=>$bh))}">
                                <button type="button" class="btn btn-default btn-lg">下一周</button>
                            </a></div>
                        </if>
                    </div>
                </div>

            </div>
        </div>

    </div>


    <footer>
        <hr>


    </footer>

</div>
</div>
</div>
<script type="text/javascript">
    function sendsj(wb, k) {

        if (wb === 'sw') {
            var coursename = $('#coursenamesw' + k).val();
            var start_time = $('#start_time' + k).val();
            var classs = $('#classsw' + k).val();
            var teacher = $('#teachersw' + k).val();
            var number = $('#numbersw' + k).val();
            var crc = $('#crcsw' + k).val();
            var courseid = $('#courseid').val();
            var is_am = 1;
        }
        else if (wb === 'xw') {
            var coursename = $('#coursenamexw' + k).val();
            var start_time = $('#start_time' + k).val();
            var classs = $('#classxw' + k).val();
            var teacher = $('#teacherxw' + k).val();
            var number = $('#numberxw' + k).val();
            var crc = $('#crcxw' + k).val();
            var courseid = $('#courseid').val();
            var is_am = 2;


        }
        else if (wb === 'ww') {
            var coursename = $('#coursenameww' + k).val();
            var start_time = $('#start_time' + k).val();
            var classs = $('#classww' + k).val();
            var teacher = $('#teacherww' + k).val();
            var number = $('#numberww' + k).val();
            var crc = $('#crcww' + k).val();
            var courseid = $('#courseid').val();
            var is_am = 3;
        }
        $.ajax({
            type: "POST",
            url: "__CONTROLLER__/Addcurr",

            cache: false,
            data: {
                coursename: coursename,
                start_time: start_time,
                teacher: teacher,
                number: number,
                class: classs,

                crc: crc,
                is_am: is_am,
                courseid: courseid


            },

            success: function (data) {
                switch (data) {

                    case '0':
                        alert('添加成功');
                        window.location.reload();
                        break;
                    case '1':
                        alert('添加失败');

                        break;
                    case '3':
                        alert('编号已存在');
                        break;
                    default:
                        alert(data);
                }

            }


        });


    }

    function del(id) {
        if (window.confirm('你确定要删除吗？')) {
            $.ajax({
                type: "POST",
                url: "__CONTROLLER__/delcurr",

                cache: false,
                data: {

                    id: id

                },

                success: function (data) {
                    switch (data) {

                        case '0':
                            alert('删除成功');
                            window.location.reload();

                            break;
                        case '1':
                            alert('删除失败');

                            break;
                            break;
                        default:
                            alert(data);
                    }

                }

            });
        } else {
            //alert("取消");
            return false;
        }


    }

    function tj() {
        var bcbh = $('#courseid').val();
        $.ajax({
            type: "POST",
            url: "__CONTROLLER__/Addcurr",

            cache: false,
            data: $('#tab').serialize(),

            success: function (data) {
                switch (data) {

                    case '0':

                        if (confirm("是否继续添加课程信息")) {
                            window.location.href = "__CONTROLLER__/Addcurr/bcbh/" + bcbh + "";
                        } else {
                            window.location.replace("__CONTROLLER__/Currinfo");
                        }

                        break;
                    case '1':
                        alert('添加失败');

                        break;
                    case '3':
                        alert('编号已存在');
                        break;
                    default:
                        alert(data);
                }

            }


        })


    }
</script>

<script src="__PUBLIC__/lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function () {
        $('.demo-cancel-click').click(function () {
            return false;
        });
    });
</script>

</body>
</html>


